package com.liangsui.mss.controller.system;

import com.liangsui.mss.dto.OperLogDto;
import com.liangsui.mss.service.OperLogService;
import com.liangsui.mss.vo.AjaxResult;
import com.liangsui.mss.vo.DataGridView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * OprLogController
 *
 * @author zhangjiawei
 * @email 1533167396@qq.com
 * @date 2022/12/5 14:25
 */
@RestController
@RequestMapping("system/operLog")
public class OperLogController {
    @Autowired
    private OperLogService operLogService;

    /**
     * 功能描述: 分页查询操作日志
     */
    @GetMapping("listForPage")
    public AjaxResult listForPage(OperLogDto operLogDto) {
        DataGridView gridView = operLogService.listForPage(operLogDto);
        return AjaxResult.success("查询成功", gridView.getData(), gridView.getTotal());
    }

    /**
     * 删除
     */
    @DeleteMapping("deleteOperLogByIds/{infoIds}")
    public AjaxResult deleteOperLogByIds(@PathVariable Long[] infoIds) {
        return AjaxResult.toAjax(this.operLogService.deleteOperLogByIds(infoIds));
    }

    /**
     * 清空删除
     */
    @DeleteMapping("clearAllOperLog")
    public AjaxResult clearAllOperLog() {
        return AjaxResult.toAjax(this.operLogService.clearAllOperLog());
    }
}
